import request from '@/utils/request'

// 添加课程信息
export function addCourse(courseInfo) {
  return request({
    url: `edu/course/addcourse`,
    method: 'post',
    data: courseInfo
  })
}

// 修改课程信息
export function editCourse(courseInfo) {
  return request({
    url: `edu/course/editcourse`,
    method: 'put',
    data: courseInfo
  })
}

export function getCourseById(courseId) {
  return request({
    url: `/edu/course/getcourse/${courseId}`,
    method: 'get'
  })
}

//获取发布对象
export function getPublishVo(courseId) {
  return request({
    url: `/edu/course/getPublishVo/${courseId}`,
    method: 'get'
  })
}

//发布
export function publish(courseId) {
  return request({
    url: `/edu/course/publish/${courseId}`,
    method: 'get'
  })
}

// 课程列表 courseList
// /getAll/{pageNum}/{limit}
export function courseList(pageNum, limit, courseQuery) {
  return request({
    url: `/edu/course/getAll/${pageNum}/${limit}`,
    method: 'post',
    data: courseQuery
  })
}

// 删除课程
export function deleteCourse(courseId) {
  return request({
    url: `/edu/course/deleteCourse/${courseId}`,
    method: 'delete'
  })
}
